#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main()
{
	int r=0,i=0,m=0;
	char str[80] = { 0 };
	char z = 0;
	int index = 0;
	int flag = 0;
	scanf("%d", &r);
	getchar();
	for (i = 0; i < r; i++)
	{
		scanf("%c",&z);
		getchar();
		scanf("%s", str);
		m = strlen(str);
		for (index = m - 1; index >= 0; index--)
			if (index>=0&&str[index] == z)
			{
				flag = 1;
				break;
			}
		if (flag)
			printf("index = %d", index);
		else
			printf("Not Found");
		flag = 0; z = 0;
	}
	return 0;
}